package org.java.order.conf;

import org.apache.ibatis.type.LocalDateTimeTypeHandler;
import org.springframework.stereotype.Component;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;

/**
 * @author WHQ
 * @version 1.0
 * @date 2022-3-15 0015 下午 4:53
 * 解决插入时间类型的数据报空指针异常
 */
@Component
public class LocalDateTimeTypeHandlerPlus extends LocalDateTimeTypeHandler {
    @Override
    public LocalDateTime getResult(ResultSet rs, String columnName) throws SQLException {
        Object object = rs.getObject(columnName);
        if (object==null){
            return null;
        }
        return super.getResult(rs, columnName);
    }
}
